// import { PlaneBufferGeometry } from 'three'
// import { Color } from 'three'
import {
  Mesh,
  Line,
  Points,
  BoxBufferGeometry,
  MeshStandardMaterial,
  SphereBufferGeometry,
  CylinderBufferGeometry,
  PointsMaterial,
} from 'three'
import { aerialTexture } from './Ttextures'
// import { VertexNormalsHelper } from 'three/examples/jsm/helpers/VertexNormalsHelper'
// import { pictureTexture } from './Ttextures'

export const basicObjectList = []

const material = new MeshStandardMaterial({ color: 'blue' }) //共用材质
const gemoetry = new BoxBufferGeometry(10, 10, 10) //共用几何

export const box = new Mesh(
  gemoetry,
  new MeshStandardMaterial({ color: 'rgb(0,0,255)' })
) //渲染立方体

box.position.x = -10

// Points点渲染
export const spherel = new Points(
  new SphereBufferGeometry(5),
  new PointsMaterial({ color: `blue` })
)

// Line线渲染
export const spherep = new Line(
  new SphereBufferGeometry(5),
  new MeshStandardMaterial()
)

// Mesh 网格物体
export const sphere = new Mesh(
  new SphereBufferGeometry(5), //几何
  material //网格标准材质
)
sphere.position.x = 10

// 柱体
export const cylinder = new Mesh(
  new CylinderBufferGeometry(5, 5, 10, 32, 5),
  material
)

cylinder.position.x = 10
cylinder.position.z = 10

export const cylinder2 = new Mesh(
  new CylinderBufferGeometry(5, 5, 10, 32, 5),
  new MeshStandardMaterial()
)

cylinder2.position.x = -10
cylinder2.position.z = -10

//地面
const stage = new Mesh(
  new BoxBufferGeometry(400, 10, 400),
  aerialTexture
  // new MeshStandardMaterial({
  //   // color: `rgb(120,200,200)`,
  //   // roughness: 0, //粗糙度
  // })
)
stage.position.y = -5
stage.receiveShadow = true //地板接收阴影

// 立方体
const BOX = new Mesh(
  new BoxBufferGeometry(20, 20, 20),
  new MeshStandardMaterial({
    color: 'white',
    // metalness: 1,//金属度
    // roughness: 0.4,//粗糙度,
    // map:pictureTexture,
  })
)
BOX.position.y = 10
BOX.position.x = 20
BOX.castShadow = true //立方体产生阴影

// 法线
// const boxNormalHelper = new VertexNormalsHelper(
//   BOX,
//   10,
//   new Color('blue').getHex()
// )

// // 图片(平面几何体)
// const plane = new Mesh(
//   new PlaneBufferGeometry(100, 100),
//   new MeshStandardMaterial({
//     map: pictureTexture, //纹理贴图
//   })
// )
// plane.position.y = 50
// plane.scale.set(0.5, 0.5, 0.5)

// plane.addEventListener('mouseenter', () => {
//   console.log('mouseenter')
//   // plane.material.color = new Color('red')
// })
// plane.addEventListener('mouseleave', () => {
//   console.log('mouseleave')
//   // plane.material.color = new Color('white')
// })
// plane.addEventListener('mousemove', () => {
//   console.log('mousemove')
//   // plane.material.color = new Color('red')
// })
// plane.addEventListener('mousedown', () => {
//   console.log('mousedown')
//   // plane.material.color = new Color('white')
// })
// plane.addEventListener('mouseup', () => {
//   console.log('mouseup')
//   // plane.material.color = new Color('white')
// })
// plane.addEventListener('click', () => {
//   console.log('click')
//   // plane.material.color = new Color('white')
// })

// basicObjectList.push(stage, BOX, plane, boxNormalHelper)
basicObjectList.push(stage)
